/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package homebudget;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author lukasz
 */
@Entity
@Table(name = "budzet", catalog = "budzet", schema = "")
@NamedQueries({
    @NamedQuery(name = "Budzet.findAll", query = "SELECT b FROM Budzet b"),
    @NamedQuery(name = "Budzet.findByIdBudzet", query = "SELECT b FROM Budzet b WHERE b.idBudzet = :idBudzet"),
    @NamedQuery(name = "Budzet.findByNazwa", query = "SELECT b FROM Budzet b WHERE b.nazwa = :nazwa"),
    @NamedQuery(name = "Budzet.findByIdWydatek", query = "SELECT b FROM Budzet b WHERE b.idWydatek = :idWydatek"),
    @NamedQuery(name = "Budzet.findByIdPrzychod", query = "SELECT b FROM Budzet b WHERE b.idPrzychod = :idPrzychod")})
public class Budzet implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_Budzet")
    private Integer idBudzet;
    @Basic(optional = false)
    @Column(name = "nazwa")
    private String nazwa;
    @Basic(optional = false)
    @Column(name = "id_wydatek")
    private int idWydatek;
    @Basic(optional = false)
    @Column(name = "id_przychod")
    private int idPrzychod;

    public Budzet() {
    }

    public Budzet(Integer idBudzet) {
        this.idBudzet = idBudzet;
    }

    public Budzet(Integer idBudzet, String nazwa, int idWydatek, int idPrzychod) {
        this.idBudzet = idBudzet;
        this.nazwa = nazwa;
        this.idWydatek = idWydatek;
        this.idPrzychod = idPrzychod;
    }

    public Integer getIdBudzet() {
        return idBudzet;
    }

    public void setIdBudzet(Integer idBudzet) {
        Integer oldIdBudzet = this.idBudzet;
        this.idBudzet = idBudzet;
        changeSupport.firePropertyChange("idBudzet", oldIdBudzet, idBudzet);
    }

    public String getNazwa() {
        return nazwa;
    }

    public void setNazwa(String nazwa) {
        String oldNazwa = this.nazwa;
        this.nazwa = nazwa;
        changeSupport.firePropertyChange("nazwa", oldNazwa, nazwa);
    }

    public int getIdWydatek() {
        return idWydatek;
    }

    public void setIdWydatek(int idWydatek) {
        int oldIdWydatek = this.idWydatek;
        this.idWydatek = idWydatek;
        changeSupport.firePropertyChange("idWydatek", oldIdWydatek, idWydatek);
    }

    public int getIdPrzychod() {
        return idPrzychod;
    }

    public void setIdPrzychod(int idPrzychod) {
        int oldIdPrzychod = this.idPrzychod;
        this.idPrzychod = idPrzychod;
        changeSupport.firePropertyChange("idPrzychod", oldIdPrzychod, idPrzychod);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idBudzet != null ? idBudzet.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Budzet)) {
            return false;
        }
        Budzet other = (Budzet) object;
        if ((this.idBudzet == null && other.idBudzet != null) || (this.idBudzet != null && !this.idBudzet.equals(other.idBudzet))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "homebudget.Budzet[idBudzet=" + idBudzet + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
